﻿using System.Diagnostics;

namespace demo;

class DiagnosticObserver : IObserver<DiagnosticListener>, IObserver<KeyValuePair<string, object>>
{
    public void OnCompleted()
    {

    }

    public void OnError(Exception error)
    {
        Console.WriteLine($"error: {error}");
    }

    public void OnNext(DiagnosticListener value)
    {
        value.Subscribe(this);
    }

    public void OnNext(KeyValuePair<string, object> value)
    {
        Console.WriteLine(value.Value.ToString());
    }
}
